import request from './request';

// 判断模块API
export function getJudgmentQuestions(params: any) {
  return request({
    url: '/api/judgment/questions',
    method: 'get',
    params,
  });
}

// 通用接口名称
export function getQuestions(params: any) {
  return getJudgmentQuestions(params);
}

export function addJudgmentQuestion(data: any) {
  return request({
    url: '/api/judgment/questions',
    method: 'post',
    data,
  });
}

// 通用接口名称
export function addQuestion(data: any) {
  return addJudgmentQuestion(data);
}

export function updateJudgmentQuestion(id: string, data: any) {
  return request({
    url: `/api/judgment/questions/${id}`,
    method: 'put',
    data,
  });
}

// 通用接口名称
export function updateQuestion(id: string, data: any) {
  return updateJudgmentQuestion(id, data);
}

export function deleteJudgmentQuestion(id: string) {
  return request({
    url: `/api/judgment/questions/${id}`,
    method: 'delete',
  });
}

// 批量删除判断题目
export function batchDeleteJudgmentQuestions(ids: string[]) {
  return request({
    url: '/api/judgment/questions/batch',
    method: 'delete',
    data: ids
  });
}

// 通用接口名称
export function deleteQuestion(id: string) {
  return deleteJudgmentQuestion(id);
}

// 通用批量删除接口名称
export function batchDeleteQuestions(ids: string[]) {
  return batchDeleteJudgmentQuestions(ids);
}

// 提交答案
export function submitAnswer(data: any) {
  return request({
    url: '/api/judgment/submit',
    method: 'post',
    data,
  });
}

// 获取单个判断题目
export function getJudgmentQuestion(id: string) {
  return request({
    url: `/api/judgment/questions/${id}`,
    method: 'get',
  });
}

// 通用接口名称
export function getQuestion(id: string) {
  return getJudgmentQuestion(id);
}

// 获取练习题目
export function getPracticeQuestions(params: any) {
  return request({
    url: '/api/judgment/practice',
    method: 'get',
    params,
  });
}

// 通用练习接口名称
export function getPractice(params: any) {
  return getPracticeQuestions(params);
}
